home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc
- Path: news.clark.net!bms88!stuart
- From: stuart@bmsi.com (Stuart D. Gathman)
- Subject: Re: C++ with Zapp vs. Delphi
- Organization: Business Management Systems, Inc., Fairfax, VA
- Date: Wed, 31 Jan 1996 03:58:39 GMT
- Message-ID: <1996Jan31.035839.11567@bmsi.com>
- References: <4dk38h$gdr@merlin.delphi.com> <4dksp1$3d6c@tigger.cc.uic.edu> <4e1i7t$v29@klein.delphi.com>
-
- In article <4e1i7t$v29@klein.delphi.com> you write:
- >>If you have MI it's easy. Just create a class called SortedObject with
- >>a virtual method called CompareTo. Store objects of that type in the list.
- >
- > Abstract method in Delphi.
- >
- >>An class that need to get stored can then inherit from SortedObject.
- >>Unfortunately you can't use this in Delphi since you know some of the
- >>classes already inherit from something else.
- >
- > You can to do this! Look at TStrings!
- >
- >>If your language is dynamically typed, it's easy. In the sort routine
- >>send the message CompareTo. Unfortunatly Delphi is statically typed.
- >
- > Just CALL it! (Declare an Abstract!)
- >
- > Either we are miscommunicating, and one of us does not understand the
- >other, or both, but it seems to me you may want to check into Delphi a little
- >more.
- >
- > If I am not understanding you, excuse me. I can read C, but am by no
- >means a C expert.
-
- Hi! C++ uses the same inheritance mechanism for both interfaces
- and implementation. A C++ only person has trouble realizing that
- just because a language provides SI implementation, that doesn't
- prevent it from providing MI interfaces.
-
- Something similar to abstract methods in Delphi appears as an ex-
- tension in GNU C++. There they are called signatures. Signa-
- tures have their own inheritance hierarchy independent of stan-
- dard class inheritance. One can attach a signature to *any*
- class providing the required methods - regardless of inheritance.
- They are implemented as a pointer to the real object and a vtble
- that forwards all signature methods to the real object.
-
- Java also follows this pattern. SI plus MI interfaces. It has a
- lot to recommend it. Forces you to keep interface and implementation
- seperate.
-
- Again, the C++ people you are talking to are correct in insisting
- that MI is essential in C++ - this is the only way an object can
- conform to multiple interfaces! It is a leap for C++ers to realize
- that classic inheritance is not the only way to provide an
- interface.
- --
- Stuart D. Gathman <stuart@bmsi.com> / <..!uunet!bms88!stuart>
- Business Management Systems Inc.
- Phone: 703 591-0911 Fax: 703 591-6154
- "Microsoft is the QWERTY of Operating Systems" - SDG
-